<?php

namespace Drupal\shushengyuan\Schemas;

use Drupal\shusy_cash\Entity\ShusyCash;

/**
 * @OA\Schema(
 *   schema="CashItem",
 *   type="object",
 *   description="CashItem"
 * )
 */
class CashItem extends AbstractBaseModel {

  protected function getEntityType() {
    return 'shusy_cash';
  }

  protected function setValue() {
    if ($this->entity instanceof ShusyCash) {
      $value = [
        'id' => $this->entity->id,
        /**
         * @OA\Property(
         *   property="amount",
         *   type="number",
         *   description="提现金额",
         * ),
         */
        'amount' => $this->convertYuan($this->entity->amount),
        /**
         * @OA\Property(
         *   property="info",
         *   type="string",
         *   description="提现说明",
         * ),
         */
        'info' => $this->entity->info,
        /**
         * @OA\Property(
         *   property="created",
         *   type="string",
         *   description="提现时间",
         * ),
         */
        'created' => $this->formatDate($this->entity->created, 'm月d号 H:i:s'),
        /**
         * @OA\Property(
         *   property="status",
         *   type="integer",
         *   description="提现状态",
         * ),
         */
        //@todo 状态未定义
        'status' => $this->entity->status,
      ];
      $this->merge($value);
    }
  }
}
